package exer;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @author tongchen
 * @create 2023-01-13 19:06
 */
public class BlockingQueueTest {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<Integer>blockingQueue=new LinkedBlockingQueue<>(3);
        blockingQueue.put(1);
        blockingQueue.put(2);
        blockingQueue.put(3);
        System.out.println("加入三个元素");
       // blockingQueue.put(4);
        //System.out.println("加入第四个元素");
        blockingQueue.take();
        blockingQueue.take();
        blockingQueue.take();
        System.out.println("清除三个元素");
        //blockingQueue.take();
        //System.out.println("清除第四个元素");
    }
}
